﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" EnableEventValidation="true" AutoEventWireup="true" CodeBehind="Content.aspx.cs" Inherits="InternetShop.Content" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
    <style type="text/css">
        .asc  
        {
            background-image:url('Styles/images/sort-arrows.jpg');
            background-position: right -8px;
            background-repeat: no-repeat;
            padding-right: 15px;
        }
        .desc  
        {
            background-image:url('Styles/images/sort-arrows.jpg');
            background-position: right 8px;
            background-repeat: no-repeat;
            padding-right: 15px;
        }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <asp:Label runat="server" ID="lblSort" Text="Sort by"></asp:Label>
    <asp:LinkButton runat="server" ID="lbtnSortByPrice" CssClass="asc" Text="Price" 
        onclick="lbtnSortByPrice_Click"></asp:LinkButton>
    <asp:LinkButton runat="server" ID="lbtnSortByName" 
        onclick="lbtnSortByName_Click">Name</asp:LinkButton>
    <p>
        <asp:LinkButton runat="server" ID="lbPrev" onclick="lbPrev_Click">Previous page</asp:LinkButton>
        <asp:Label runat="server" ID="lblCurPage">1</asp:Label>&nbsp;of&nbsp;<asp:Label runat="server" ID="lblTotal">1</asp:Label>
        <asp:LinkButton runat="server" ID="lbNext" onclick="lbNext_Click">Next page</asp:LinkButton>
    </p>
    <asp:Repeater ID="rItems" runat="server" OnItemCommand="rItems_ItemCommand" 
        onitemdatabound="rItems_ItemDataBound">
        <HeaderTemplate>
            <table>
                <thead style="background-color: Aqua;"><tr>
                    <td>Image</td>
                    <td>Brand</td>
                    <td>Model</td>
                    <td>Description</td>
                    <td>Price</td>
                    <%if (HasCurrentUserRights())
                      { %>
                    <td>Basket</td>
                    <% } %>
                </tr></thead>
                <tbody>
        </HeaderTemplate>
        <ItemTemplate>
                <tr>
                    <td><img style="height:100px; width: 70px;" src="<%# GeneratePath(Container.DataItem)%>" alt="X" /></td>
                    <td><%# Eval("Brand") %></td>
                    <td><%# Eval("Model") %></td>
                    <td><%# Eval("Description") %></td>
                    <td><%# Eval("Price") %></td>
                    <%if (HasCurrentUserRights())
                      { %>
                    <td>
                        <asp:LinkButton ID="lbtnAdd" runat="server" Text="Add to basket" Visible="false"/>
                        <asp:Label ID="lblAdded" runat="server" Text="Added" Visible="false"></asp:Label>
                    </td>
                    <% } %>
                </tr>
        </ItemTemplate>
        <FooterTemplate>
            </tbody>
          </table>
        </FooterTemplate>
    </asp:Repeater>
</asp:Content>
